home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 25 / Cream of the Crop 25.iso / program / flip3206.zip / DEMO.CPP < prev    next >
C/C++ Source or Header  |  1997-03-23  |  2KB  |  78 lines

  1. // --------------------------------------------------------------------------
  2. //  FLIP32.CPP           copyright (c) 1996-97, Xavier Defrang (aka brioche)
  3. // --------------------------------------------------------------------------
  4. //  simple demonstration of what FLIP32 is able to do...
  5. // --------------------------------------------------------------------------
  6. //  e-mail: 106146.1452@compuserve.com
  7. // --------------------------------------------------------------------------
  8.  
  9. #include <stdio.h>
  10. #include <stdlib.h>
  11. #include <conio.h>
  12. #include "types.h"
  13. #include "flip32.h"
  14.  
  15. #define FLI_NAME "nice.fli"
  16.  
  17. UBYTE *vga = (UBYTE *)0xa0000;
  18.  
  19. // --------------------------------------------------------------------------
  20.  
  21. void flip32_play( void )
  22. {
  23.  framecnt = 0;
  24.  while ( !kbhit() ) 
  25.  {
  26.   fread( &framehdr, 0x10, 1, flifile );
  27.   fread( framebuf, framehdr.size-0x10, 1, flifile );
  28.   flip32_unpack( framebuf, vga, framehdr.chunks );
  29.   flip32_wait( flihdr.speed );  
  30.   if ( framecnt++ == flihdr.frames ) 
  31.   {
  32.    fseek( flifile, 0x80, SEEK_SET );
  33.    framecnt = 0;
  34.   }
  35.  }
  36. }
  37.  
  38. // --------------------------------------------------------------------------
  39.  
  40. void printmsg( const char *msg )
  41. {
  42.  printf( "[FLIP32] %s\n", msg );
  43. }
  44.  
  45. // --------------------------------------------------------------------------
  46.  
  47. void main( void )
  48. {
  49.  vmode( 0x03 );
  50.  
  51.  puts( "FLIP32 version 0.6B  by Xavier Defrang" );
  52.  puts( "32-bit protected mode animation player\n" );
  53.  
  54.  if ( !( flip32_init() ) ) return;
  55.  
  56.  if ( !( flip32_load( FLI_NAME ) ) )
  57.  {
  58.   flip32_done();
  59.   return;
  60.  }
  61.  
  62.  printmsg( "press any key to play animation..." );
  63.  
  64.  getch();
  65.  
  66.  vmode( 0x13 );
  67.  
  68.  flip32_play();
  69.  
  70.  vmode( 0x03 );
  71.  
  72.  flip32_close();
  73.  
  74.  flip32_done();
  75.  
  76.  printmsg( "ending." );
  77. }
  78.